package org.edu.controller;

import javax.annotation.Resource;


import org.apache.struts2.ServletActionContext;
import org.edu.bean.Taxlaw;
import org.edu.common.PageView;
import org.edu.common.QueryResult;

import org.edu.service.TaxlawService;

import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
public class TaxlawController extends ActionSupport {
	private Integer page = 1;
	private Taxlaw entity;
	@Resource
	private TaxlawService taxlawservice;
	public Integer getPage() {
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	public Taxlaw getEntity() {
		return entity;
	}
	public void setEntity(Taxlaw entity) {
		this.entity = entity;
	}
	public TaxlawService getTaxlawservice() {
		return taxlawservice;
	}
	public void setTaxlawservice(TaxlawService taxlawservice) {
		this.taxlawservice = taxlawservice;
	}
	public String input() throws Exception {
		try{
			taxlawservice.save(entity);
		}catch(Exception e){
			e.printStackTrace();
		}
		PageView< Taxlaw> pageView = new PageView<Taxlaw>(20,page);
		QueryResult<Taxlaw> result = taxlawservice.getQueryResult(pageView.getFirstResult(),pageView.getMaxresult());
		pageView.setQueryResult(result);
		ServletActionContext.getRequest().setAttribute("pageView",pageView);
		return "input";
	}
}
